package tree;

public class Test {
    public static void main(String[] args) {

        //先根据节点关系，构建每一个节点，之后二叉树添加根节点
        TreeNode t0 = new TreeNode(0);
        TreeNode t1 = new TreeNode(1);
        TreeNode t2 = new TreeNode(2);
        TreeNode t3 = new TreeNode(3,null,t2);
        TreeNode t4 = new TreeNode(4,t0,null);
        TreeNode t5 = new TreeNode(5,t1,t4);
        TreeNode t9 = new TreeNode(9);
        TreeNode t6 = new TreeNode(6,t9,t3);
        TreeNode t8 = new TreeNode(8,t5,t6);


        //构建一个二叉树
        Tree tree = new Tree(t8);

        tree.first(tree.getRoot());
        System.out.println();
        tree.middle(tree.getRoot());
        System.out.println();
        tree.last(tree.getRoot());

    }
}
